package com.example.computer_exam_training_sys.mapper;

import com.example.computer_exam_training_sys.vo.QuestionPreviewDTO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface QuestionPreviewDTOMapper {
    @Select("SELECT pq.id, pq.paper_id, pq.question_id, pq.question_order, pq.score, " +
            "q.point_id, q.question_type, q.difficulty, q.content, q.answer, q.analysis, " +
            "q.reported_count, q.create_time, q.update_time, q.status " +
            "FROM paper_questions pq " +
            "JOIN questions q ON pq.question_id = q.question_id " +
            "WHERE pq.paper_id = #{paperId} " +
            "ORDER BY pq.question_order")
    List<QuestionPreviewDTO> getPreviewByPaperId(@Param("paperId") Integer paperId);

}
